package com.playball.lottery.util;

import java.util.ArrayList;
import java.util.List;

/**
 * 快三工具类
 * 
 * @author riseman
 * 
 */
public class Kuai3Util {
	/**
	 * 获取快三和值最大奖金，最小奖金
	 * 
	 * @param tempint
	 * @return
	 */
	public static String getkuai3HeZhiJiangJin(int[] tint) {
//		if(tint.length!=0){
//			for (int i = 0; i < tint.length; i++) {
//				 System.out.println("Kuai3Util tint[i]= "+tint[i]);
//			}
//		}
		 
		String str = null;
		// 转化投注号为奖金
		// int tint[] = { 13, 4, 5, 6, 7, 666, 8, 111 };
		List<Integer> moneylist = new ArrayList<Integer>();
		for (int i = 0; i < tint.length; i++) {
			if (tint[i] == 111||tint[i] == 3) {
				moneylist.add(240);
			}
			if (tint[i] == 4) {
				moneylist.add(80);
			}
			if (tint[i] == 5) {
				moneylist.add(40);
			}
			if (tint[i] == 6) {
				moneylist.add(25);
			}
			if (tint[i] == 7) {
				moneylist.add(16);
			}
			if (tint[i] == 8) {
				moneylist.add(12);
			}
			if (tint[i] == 9) {
				moneylist.add(10);
			}
			if (tint[i] == 10) {
				moneylist.add(9);
			}
			if (tint[i] == 11) {
				moneylist.add(9);
			}
			if (tint[i] == 12) {
				moneylist.add(10);
			}
			if (tint[i] == 13) {
				moneylist.add(12);
			}
			if (tint[i] == 14) {
				moneylist.add(16);
			}
			if (tint[i] == 15) {
				moneylist.add(25);
			}
			if (tint[i] == 16) {
				moneylist.add(40);
			}
			if (tint[i] == 17) {
				moneylist.add(80);
			}
			if (tint[i] == 666||tint[i] == 18) {
				moneylist.add(240);
			}
		}

//		 System.out.println("moneylist= " + moneylist.toString());

		int[] tempint;
		Integer[] ai = moneylist.toArray(new Integer[0]);
		// for (int i = 0; i < a.length; i++) {
		// System.out.println(a[i]);
		// }
		tempint = integers2intValues(ai);
		// System.out.println("tempint.length= " + tempint.length);
		int max = 0;
		int min = 0;
		if (tempint.length != 0) {
			max = min = tempint[0];
			for (int i = 0; i < tempint.length; i++) {
				if (tempint[i] > max) {
					max = tempint[i];
				}
				if (tempint[i] < min) {
					min = tempint[i];
				}
			}
		}

//		 System.out.println("Kuai3Util 最大数是：" + max);
//		 System.out.println("Kuai3Util 最小数是:" + min);
		str = min + "|" + max;
		return str;
	}

	/**
	 * 从Integer数组转换成int数组 Integer [] => int []
	 * 
	 * @param params
	 *            Integer数组
	 * @return int []
	 */
	public final static int[] integers2intValues(Integer[] params) {
		int len = params.length;
		int[] temp = new int[len];
		for (int i = 0; i < len; i++) {
			temp[i] = params[i];
		}
		return temp;
	}
	
	/**
	 * 获取快三汉字玩法名称
	 * @param playTypeId 快三玩法数字ID
	 * @return 快三汉字玩法名称
	 */
	public final static String getNewKuai3PlayType(int playTypeId) {
		String strPlayType = "";
		if (playTypeId==6601) {
			strPlayType = "和值";
		} else if (playTypeId==6602) {
			strPlayType = "三同号通选";
		} else if (playTypeId==6603) {
			strPlayType = "三连号通选";
		} else if (playTypeId==6604) {
			strPlayType = "三同号单选";
		} else if (playTypeId==6605) {
			strPlayType = "三不同号";
		} else if (playTypeId==6606) {
			strPlayType = "二同号复选";
		} else if (playTypeId==6607) {
			strPlayType = "二同号单选";
		} else if (playTypeId==6608) {
			strPlayType = "二不同号";
		} 
		return strPlayType;
	}

	/**
	 * 获取重庆时时彩 奖金额
	 * @param strPlayType 重庆时时彩玩法
	 * @return  奖金额
	 */
	public final static int getCqsscMoney(String strPlayType) {
		// 奖金
		int totalmoney = 0;
		if (strPlayType.equals("五星直选")) {
			totalmoney = 100000;
		} else if (strPlayType.equals("五星通选")) {
			totalmoney = 20440;
		} else if (strPlayType.equals("五星复选")) {
			totalmoney = 101110;
		} else if (strPlayType.equals("三星直选")) {
			totalmoney = 1000;
		} else if (strPlayType.equals("三星复选")) {
			totalmoney = 1110;
		} else if (strPlayType.equals("二星直选")) {
			totalmoney = 100;
		} else if (strPlayType.equals("二星复选")) {
			totalmoney = 110;
		} else if (strPlayType.equals("二星组选")) {
			totalmoney = 50;
		} else if (strPlayType.equals("一星复式")) {
			totalmoney = 10;
		} else if (strPlayType.equals("大小单双复式")) {
			totalmoney = 4;
		}
		return totalmoney;
	}
	
	/**
	 * 获取十一选五 奖金额
	 * @param playTypeId 十一选五玩法
	 * @return 奖金额
	 */
	public final static int get11x5Money(int playTypeId) {
		// 奖金
		int totalmoney = 0;
		if (playTypeId==7001) {
			totalmoney = 13;
		} else if (playTypeId==7002) {
			totalmoney = 6;
		} else if (playTypeId==7003) {
			totalmoney = 19;
		} else if (playTypeId==7004) {
			totalmoney = 78;
		} else if (playTypeId==7005) {
			totalmoney = 540;
		} else if (playTypeId==7006) {
			totalmoney = 90;
		} else if (playTypeId==7007) {
			totalmoney = 26;
		} else if (playTypeId==7008) {
			totalmoney = 9;
		} else if (playTypeId==7009) {
			totalmoney = 130;
		} else if (playTypeId==7010) {
			totalmoney = 1170;
		} else if (playTypeId==7011) {
			totalmoney = 65;
		} else if (playTypeId==7012) {
			totalmoney = 195;
		}
		return totalmoney;
	}
	
	/**
	 * 获取十一运夺金 奖金额
	 * @param playTypeId 十一运夺金玩法
	 * @return 奖金额
	 */
	public final static int get11ydjMoney(int playTypeId) {
		// 奖金
		int totalmoney = 0;
		if (playTypeId==6201) {
			totalmoney = 13;
		} else if (playTypeId==6202) {
			totalmoney = 6;
		} else if (playTypeId==6203) {
			totalmoney = 19;
		} else if (playTypeId==6204) {
			totalmoney = 78;
		} else if (playTypeId==6205) {
			totalmoney = 540;
		} else if (playTypeId==6206) {
			totalmoney = 90;
		} else if (playTypeId==6207) {
			totalmoney = 26;
		} else if (playTypeId==6208) {
			totalmoney = 9;
		} else if (playTypeId==6209) {
			totalmoney = 130;
		} else if (playTypeId==6210) {
			totalmoney = 1170;
		} else if (playTypeId==6211) {
			totalmoney = 65;
		} else if (playTypeId==6212) {
			totalmoney = 195;
		}
		return totalmoney;
	}
}
